GETPEERNAME

Section: System Calls (2)
Index Return to Main Contents

BSD mandoc
BSD 4.2  

NAME

getpeername - get name of connected peer  

SYNOPSIS

Ft int Fn getpeername int s struct sockaddr *name int *namelen  

DESCRIPTION

Fn Getpeername returns the name of the peer connected to socket Fa s . The Fa namelen parameter should be initialized to indicate the amount of space pointed to by Fa name . On return it contains the actual size of the name returned (in bytes). The name is truncated if the buffer provided is too small.  

DIAGNOSTICS

A 0 is returned if the call succeeds, -1 if it fails.  

ERRORS

The call succeeds unless:

Bq Er EBADF
The argument Fa s is not a valid descriptor.
Bq Er ENOTSOCK
The argument Fa s is a file, not a socket.
Bq Er ENOTCONN
The socket is not connected.
Bq Er ENOBUFS
Insufficient resources were available in the system to perform the operation.
Bq Er EFAULT
The Fa name parameter points to memory not in a valid part of the process address space.

 

SEE ALSO

accept(2), bind(2), socket(2), getsockname(2)  

HISTORY

The Fn getpeername function call appeared in BSD 4.2


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
ERRORS
SEE ALSO
HISTORY

This document was created by man2html, using the manual pages.
Time: 16:28:59 GMT, April 18, 2022